using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace GameForKids
{

    public class Line
    {
        Texture2D pixel;
        public int Thickness = 5;
        public float Depth;
        public void setThickness(int x)
        {
            Thickness = x;
        }
        public Line(GraphicsDevice graphicsDevice, Color color)
        {
            // create pixels
            pixel = new Texture2D(graphicsDevice, 1, 1);
            Color[] pixels = new Color[1];
            pixels[0] = color;
            pixel.SetData<Color>(pixels);
            Depth = 0;
        }
        public void DrawLine(SpriteBatch spriteBatch, Vector2 start,
        Vector2 end)
        {
            // calculate the distance between the two vectors
            float distance = Vector2.Distance(start, end);
            // calculate the angle between the two vectors
            float angle = (float)Math.Atan2((double)(end.Y - start.Y),(double)(end.X - start.X));
            // stretch the pixel between the two vectors
            spriteBatch.Draw(pixel,start,null, Color.White,angle,Vector2.Zero,new Vector2(distance, Thickness), SpriteEffects.None,Depth);
        }

    }
}
